package mse.eai.jbpm.dailyDigestProcess;

import java.util.List;
import java.util.Map;

import org.hibernate.StaleObjectStateException;
import org.jboss.logging.Logger;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.node.DecisionHandler;

public class IsWinnersListEmpty implements DecisionHandler {

	// must return YES or NO
	public String decide(ExecutionContext context) throws Exception {
		
		String transition = null;

		try {
			Map<Integer,String> list = (Map<Integer,String>) context.getVariable("MapOfEmails");
			
			transition = (list.isEmpty() ? "YES" : "NO");
			
		} catch (Exception e) {
			e.printStackTrace();
			transition = "YES";

		} 

		return transition;
	}
}